package cn.zzp.ggkt.vod.controller;

import cn.zzp.ggkt.result.Result;
import cn.zzp.ggkt.vod.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Administrator
 * @description:
 * @date 2022/8/25 1:54
 */
@Api(tags = "文件上传接口")
@RestController
@CrossOrigin
@RequestMapping("/admin/vod/file")
public class FileUploadController {

    @Autowired
    private FileService fileService;

    @ApiOperation(value = "文件上传")
    @PostMapping("/upload")
    public Result upload(@ApiParam(name = "file", value = "文件", required = true)
                             @RequestParam MultipartFile file){
        String url = fileService.upload(file);

        return Result.ok(url).message("文件上传成功");
    }

}
